package VN.EDU.IMIC.DEVELOPER.TRINHCAOSANG.BaiTapObject.Exc2;

import VN.EDU.IMIC.PROJECTLEADER.NGUYENVANDOAN.OOP.EXCERCISEDEMO.EX02.CalculatorInfo;

import java.util.Scanner;

public class Views {
    public static void main(String[] args) {
        CalculatorInfo calculatorInfo = new CalculatorInfo();
        double valueA;
        double valueB;

        Scanner scanner = new Scanner(System.in);
        System.out.println(" Plz input A number");

            valueA = scanner.nextDouble();

        if (String.valueOf(valueA).equals(" ")) {
            System.out.println("A must be Double ");
            return;
        }
            System.out.println(" Plz input B number");
            valueB = scanner.nextDouble();
        if (String.valueOf(valueB).equals("")) {
            System.out.println("B must be Double ");
        }

        System.out.println("Enter your selection: 1 for +, 2 for - , 3 for * , 4 for /");
        short choose;
        choose = scanner.nextShort();
        if (choose >= 5){
            System.out.println("Choose operator again");
        }
        Caculator caculator = new Caculator();
        caculator.setNumA(valueA);
        caculator.setNumB(valueB);
        caculator.setiOpt(choose);

        Controller controller = new Controller(caculator);

        if (controller.CheckCal()){
            System.out.println("Result of " + valueA +" and " + valueB + " : " + controller.CalResult());

        }



    }

}

